you must make sure you call gtk_container_propagate_expose()
correctly, as you must for any NO_WINDOW widgets.
+ GtkFixed is a little special; it is now created by default as
+ a NO_WINDOW widget, but if you do
+
+ GTK_WIDGET_UNSET_FLAGS (fixed, GTK_WIDGET_NO_WINDOW)
+
+ after creating a fixed widget, it will create a window and
+ handle it properly.
+
* GtkLayout no longer has the xoffset, yoffset fields, which used
to store the difference between world and window coordinates for
layout->bin_window. These coordinate systems are now always
- the same.
\ No newline at end of file
+ the same.
static void
gtk_fixed_init (GtkFixed *fixed)
{
- GTK_WIDGET_UNSET_FLAGS (fixed, GTK_NO_WINDOW);
+ GTK_WIDGET_SET_FLAGS (fixed, GTK_NO_WINDOW);
fixed->children = NULL;
}
g_return_if_fail (GTK_IS_FIXED (widget));
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
- attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+ if (GTK_WIDGET_NO_WINDOW (widget))
+ GTK_WIDGET_CLASS (parent_class)->realize (widget);
+ else
+ {
+ GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+
+ attributes.window_type = GDK_WINDOW_CHILD;
+ attributes.x = widget->allocation.x;
+ attributes.y = widget->allocation.y;
+ attributes.width = widget->allocation.width;
+ attributes.height = widget->allocation.height;
+ attributes.wclass = GDK_INPUT_OUTPUT;
+ attributes.visual = gtk_widget_get_visual (widget);
+ attributes.colormap = gtk_widget_get_colormap (widget);
+ attributes.event_mask = gtk_widget_get_events (widget);
+ attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
+
+ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+
+ widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
+ attributes_mask);
+ gdk_window_set_user_data (widget->window, widget);
+
+ widget->style = gtk_style_attach (widget->style, widget->window);
+ gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+ }
}
static void
fixed = GTK_FIXED (widget);
widget->allocation = *allocation;
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- allocation->x,
- allocation->y,
- allocation->width,
- allocation->height);
+ if (!GTK_WIDGET_NO_WINDOW (widget))
+ {
+ if (GTK_WIDGET_REALIZED (widget))
+ gdk_window_move_resize (widget->window,
+ allocation->x,
+ allocation->y,
+ allocation->width,
+ allocation->height);
+ }
+
border_width = GTK_CONTAINER (fixed)->border_width;
children = fixed->children;
gtk_widget_get_child_requisition (child->widget, &child_requisition);
child_allocation.x = child->x + border_width;
child_allocation.y = child->y + border_width;
+
+ if (GTK_WIDGET_NO_WINDOW (widget))
+ {
+ child_allocation.x += widget->allocation.x;
+ child_allocation.y += widget->allocation.y;
+ }
+
child_allocation.width = child_requisition.width;
child_allocation.height = child_requisition.height;
gtk_widget_size_allocate (child->widget, &child_allocation);